package cn.alm.helloworld.config;

import dev.langchain4j.model.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LLMConfig {

    @Value("${dashscope.api.key}")
    private String dashscopeApiKey;

    @Value("${dashscope.base.url}")
    private String dashscopeBaseUrl;

    @Value("${dashscope.model.name}")
    private String dashscopeModelName;

    @Value("${baocloud.ds.api.key}")
    private String baocloudDsApiKey;

    @Value("${baocloud.ds.model.name}")
    private String baocloudDsModelName;

    @Value("${baocloud.ds.base.url}")
    private String baocloudDsBaseUrl;

    @Bean(name = "dashscope")
    public OpenAiChatModel dashscopeChatModel() {
        return OpenAiChatModel.builder()
                .apiKey(dashscopeApiKey)
                .baseUrl(dashscopeBaseUrl)
                .modelName(dashscopeModelName)
                .temperature(0.7)
                .build();
    }

    @Bean(name = "baocloud")
    public OpenAiChatModel baocloudChatModel() {
        return OpenAiChatModel.builder()
                .apiKey(baocloudDsApiKey)
                .baseUrl(baocloudDsBaseUrl)
                .modelName(baocloudDsModelName)
                .temperature(0.7)
                .build();
    }

}
